Platform Explorer / Nuxeo Platform 2021.51

Component org.nuxeo.salesforce.business-metadata

Resolution Order

852
The resolution order represents the order in which this component has been resolved by the Nuxeo Runtime framework.
You can influence this order by adding "require" tags in your component declaration, to make sure it is resolved after another component.

Contributions

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.salesforce.business-metadata">

  <!-- 
  Register the template to be used by Salesforce.RenderBusinessMetadata
  See com.quandora.web.rendering.api.DefaultDocumentView for all the fields available on a Document object in a freemarker template
  See org.nuxeo.ecm.automation.core.scripting.Scripting initBindings method for global variables available in the template 
  You can debug by putting the  resource inside the data/resources folder and referencing it using the relative name from that folder. 
  -->
  <extension target="org.nuxeo.runtime.services.resource.ResourceService" point="resources">
    <!-- resource name="salesforce-business-metadata">salesforce-business-metadata.ftl</resource -->
    <resource name="salesforce-business-metadata">OSGI-INF/salesforce-business-metadata.ftl</resource>
  </extension>

  <extension
          target="org.nuxeo.automation.scripting.internals.AutomationScriptingComponent"
          point="operation">

	<!--
	An operation which is generating a HTML fragment displaying the business metadata    
	-->
    <scriptedOperation id="Salesforce.RenderBusinessMetadata">
      <inputType>document</inputType>
      <outputType>blob</outputType>
      <category>Salesforce</category>
	  <param name="lang" type="String" />
	        
      <script>
        <![CDATA[function run(input, params) {
        	// push the client language in the context
        	ctx.SALESFORCE_LANG = params.lang;
        	var blob = Render.Document(input, {
        		template: 'template:salesforce-business-metadata'        		
        	});
        	
        	return blob.getString(); // return the html fragment as a string
        }]]>
      </script>
    </scriptedOperation>
  </extension>


</component>